package com.hotel.service;

import com.hotel.entity.Consumption;
import com.hotel.repository.ConsumptionRepository;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("consumptionService")
public class ConsumptionService {
    private final ConsumptionRepository repository;

    public ConsumptionService() {
        this.repository = new ConsumptionRepository();
    }

    public void save(Consumption consumption) {
        repository.save(consumption);
    }
    //通过入住记录id查询消费记录
    public List<Map<String, Object>> findById(Integer id) {
        return repository.findById(id);
    }

    public void deleteById(int id) {
        repository.deleteById(id);
    }

}
